home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / OBJ1_2.ZIP;1 / C_TASK.TXT < prev    next >
Encoding:
Text File  |  1992-12-22  |  6.7 KB  |  159 lines

  1. '
  2. 'Class description:
  3. '
  4. !short:Task class structure:
  5. Class Task:
  6. ~~~~~~~~~~~~
  7. This class is base for all objects, which seem to be indenpendent runing
  8. tasks. The complete task switching is enabled with object manipulation.
  9. The special menu for active window control is offered. The tasks can be
  10. switched, the window assigned to each task is movable, sizeable and can
  11. be iconised.
  12.  
  13. Common use:
  14. ~~~~~~~~~~~
  15. If you dislike standard class View for input/output manipulation, you can
  16. as superset to class Task create your own class. If you use a screen
  17. generator (with this library it needn't), you can reach the output source
  18. code of this generator to behave as class View. To do so you must:
  19. 1.Create your own class derived from task class.
  20. 2.Define own virtual methds Init(), VPaint(), Vprocess().
  21.   The method Init should set the window size range.
  22.   The method Vpaint should paint the window contet and end itself.
  23.   Vprocess() is the basic function to do when the window becomes active.
  24.   It should return control when becoming key value nSwapTask(255).
  25. Or you can simply use class ^UMask^N.
  26.  
  27. Source code is in C_Task.prg
  28.  
  29. !seealso: c_window.ngo:Window c_browse.ngo:Browse c_frame.ngo:Frame c_menu.ngo:Menu c_color.ngo:Color ob_class.ngo:"Class hierarchy"
  30.  
  31. !short:~~~~~~~~~~~~~~~~~~~~~
  32. !short:create class Task from Window
  33. !short:  export:
  34. !short:  var IsDead      //false
  35. ^BTask:IsDead^N: read-only: logical
  36.   If true, the object was succesfully destroyed. The further object
  37.   manipulation is only allowed to obtain information from its instvar
  38.   variables.
  39.  
  40. !short:  var DoneBlock   //{||true}
  41. ^BTask:DoneBlock^N: public: code_block
  42.   Here can be code block placed to do the window closing connected job.
  43.   (i.g. saving of changed text). If it returns true the object (class)
  44.   can be destroyed, if false it can't be destroyed and the control is
  45.   passed to virtual process of this task from the task swapper.
  46.   When calling the code block Task:DoneBlock is the object
  47.   of instvar variable Doneblock passed as a parameter.
  48.  
  49. !short:  method New=TaskNew           //o:New() --> self
  50. ^BTask:New()^N: public: return self
  51.   Object is filled with default values.
  52.  
  53. !short:  method Init=TaskInit         //o:Init(Name,R,C,Rs,Cs,Clr,Shd) --> true
  54. ^BTask:Init(Name,R,C,Rs,Cs,Clr,Shadow)^N: return true
  55.   Preparing job is done here by initialising the window, adding the new task
  56.   to the stack (for the task swapper), the hot keys are set. The new task
  57.   window remains unvisible after finishing of Task:Init.
  58.  
  59.   Parameter description:
  60.   ~~~~~~~~~~~~~~~~~~~~~~
  61.   ^UName^N: text alebo kodovy blok: default is {||""}, i.e. no title.
  62.    Text or code block as window title.
  63.  
  64.   ^UR^N: numeric: default is 3.
  65.    Upper window border.
  66.  
  67.   ^UC^N: numeric: default is 4.
  68.    Left window border.
  69.  
  70.   ^URs^N: numeric: default is MaxRow()-7.
  71.    Window height in number of rows passed into.
  72.  
  73.   ^UCs^N: numeric: default is MaxCol()-9.
  74.    Window widthin number of columns passed into.
  75.  
  76.   ^UClr^N: character: default is m->Color:Edit.
  77.    Window color.
  78.  
  79.   ^UShadow^N: logical: default is true for color monitor, false for monochrom.
  80.    If true, the shadow will be painted.
  81.  
  82. !short:  method GoodInit=TaskGoodInit //o:GoodInit(Name,R,C,Rs,Cs,CurSize,Clr,Shd) --> true
  83. ^BTask:GoodInit(Name,R,C,Rs,Cs,CurSize,Clr,Shadow)^N: public: return true
  84.   Preparing job is done here by initialising the window, adding the new task
  85.   to the stack (for the task swapper), the hot keys are set. The new task
  86.   window remains unvisible after finishing of Task:Init. The position of the
  87.   new window is counted by herited method GoodInit() of class Box to be
  88.   nearest possible to the cursor and not to cover any required text.
  89.   The window should be visible whole.
  90.  
  91.   Parameter description:
  92.   ~~~~~~~~~~~~~~~~~~~~~~
  93.   ^UName^N: text or code block: default is {||""}, i.e. no title
  94.    Text or code block as window title.
  95.  
  96.   ^UR^N: numeric: default is Row().
  97.    The row text position the window to be put nearest possible.
  98.  
  99.   ^UC^N: numeric: default is Col().
  100.    The column text position the window to be put nearest possible.
  101.  
  102.   ^URs^N: numeric: default is MaxRow()-7.
  103.    Required window height in number of rows passed into.
  104.  
  105.   ^UCs^N: numeric: default is MaxCol()-9.
  106.    Required window width in number of columns passed into.
  107.  
  108.   ^UCurSize^N: numeric: default is 1.
  109.    Text size that should not be covered but the window should be nearest
  110.    possible.
  111.  
  112.   ^UClr^N: character: default is m->Color:Edit.
  113.    Window colors.
  114.  
  115.   ^UShadow^N: logical: default is true for color monitor, false for monochrom.
  116.    If true,the shadow will be painted.
  117.  
  118. !short:  method Top=TaskTop           //o:Top(lRepaint) --> true
  119. ^BTask:Top(lRepaint)^N: public: return true
  120.   The task is set as active, switched to front and painted in active task
  121.   colors.
  122.  
  123.   Parameter description
  124.   ~~~~~~~~~~~~~~~~~~~~~
  125.   ^UlRePaint^N: logical: default is true
  126.     If lRepaint is true, the screen is erased and all windows are repainted
  127.     from the stack of windows.
  128.  
  129. !short:  method VProcess=TaskVProcess //o:VProcess() --> new_active_task_objekt
  130. ^BTask:VProcess()^N: public: return new_active_task_objekt
  131.   This virtual method is for active part of the task. In this class it only
  132.   waits for key pressing and the ends. It should be redefined by derived
  133.   classes for doing required job. The return value can be another object
  134.   derived from the task class and it becomes active. This enables the task
  135.   chaining, to estabilish conections between the objects (which enables
  136.   multi-threading). See the instvar variable DoneBlock. This method must be
  137.   finished when receiving the nSwapTask code (255) from the keyboard
  138.   and must be resartable. For task finishing is used method Done().
  139.  
  140. !short:  method Process=TaskProcess   //o:Process() --> true
  141. ^BTask:Process()^N: public: return true
  142.   It is aplication loop which is finished only when the main program menu
  143.   is active. The task switching is controled by task-swapper. For each
  144.   window, which becomes active is the virtual method VProcess() activated.
  145.   The creation of virtual method Process has the sense only for post
  146.   initialisation of objects of user defined class. It is sufficient to
  147.   run VPaint() (window content painting) and VProcess() (the task work).
  148.  
  149. !short:  method Done=TaskDone         //o:Done(lRePaint) --> true/false
  150. ^BTask:Done(lRePaint)^N: return true/false
  151.   The object (task) finishing, only when code block DoneBlock returns true.
  152.   It is not usual to use this method due to user requested task finishing
  153.   by pressing ESC or Ctrl-Enter when the task is active. Then is the task
  154.   finishing activated from Task:Process() method. This method is for task
  155.   finishing by own program code part.
  156.  
  157. !short:  endclass
  158.  
  159.